# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ToolResults.V1beta3.Model.MergedResult do
  @moduledoc """
  Merged test result for environment. If the environment has only one step (no reruns or shards), then the merged result is the same as the step result. If the environment has multiple shards and/or reruns, then the results of shards and reruns that belong to the same environment are merged into one environment result.

  ## Attributes

  *   `outcome` (*type:* `GoogleApi.ToolResults.V1beta3.Model.Outcome.t`, *default:* `nil`) - Outcome of the resource
  *   `state` (*type:* `String.t`, *default:* `nil`) - State of the resource
  *   `testSuiteOverviews` (*type:* `list(GoogleApi.ToolResults.V1beta3.Model.TestSuiteOverview.t)`, *default:* `nil`) - The combined and rolled-up result of each test suite that was run as part of this environment. Combining: When the test cases from a suite are run in different steps (sharding), the results are added back together in one overview. (e.g., if shard1 has 2 failures and shard2 has 1 failure than the overview failure_count = 3). Rollup: When test cases from the same suite are run multiple times (flaky), the results are combined (e.g., if testcase1.run1 fails, testcase1.run2 passes, and both testcase2.run1 and testcase2.run2 fail then the overview flaky_count = 1 and failure_count = 1).
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :outcome => GoogleApi.ToolResults.V1beta3.Model.Outcome.t() | nil,
          :state => String.t() | nil,
          :testSuiteOverviews =>
            list(GoogleApi.ToolResults.V1beta3.Model.TestSuiteOverview.t()) | nil
        }

  field(:outcome, as: GoogleApi.ToolResults.V1beta3.Model.Outcome)
  field(:state)

  field(:testSuiteOverviews,
    as: GoogleApi.ToolResults.V1beta3.Model.TestSuiteOverview,
    type: :list
  )
end

defimpl Poison.Decoder, for: GoogleApi.ToolResults.V1beta3.Model.MergedResult do
  def decode(value, options) do
    GoogleApi.ToolResults.V1beta3.Model.MergedResult.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ToolResults.V1beta3.Model.MergedResult do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
